package uqbar.comm;

public class ProgramException extends RuntimeException {

	public ProgramException() {
		super();
	}

	public ProgramException(final String message, final Throwable cause) {
		super(message, cause);
	}

	public ProgramException(final String message) {
		super(message);
	}

	public ProgramException(final Throwable cause) {
		super(cause);
	}

	public static RuntimeException wrap(final Throwable e) {
		return e instanceof RuntimeException ? (RuntimeException) e : new ProgramException(e);
	}

	public static void assertTrue(final String message, final boolean b) {
		if (!b) {
			throw new ProgramException(message);
		}

	}

	public static void assertTrue(final boolean b) {
		assertTrue(null, b);
	}
}
